<?php
/*
 |--------------------------------------------------------------------------
 | SkyCaiji (蓝天采集器)
 |--------------------------------------------------------------------------
 | Copyright (c) 2018 http://www.skycaiji.com All rights reserved.
 |--------------------------------------------------------------------------
 | 使用协议  http://www.skycaiji.com/licenses
 |--------------------------------------------------------------------------
 */

namespace Admin\Controller; use Think\Controller; if(!defined('IN_SKYCAIJI')) { exit('NOT IN SKYCAIJI'); } class SettingController extends BaseController { public function siteAction(){ $mconfig=D('Config'); if(IS_POST){ $config=array(); $config['verifycode']=I('verifycode',0,'intval'); $config['hidehome']=I('hidehome',0,'intval'); $config['login']=I('login/a',0,'intval'); if($config['login']['limit']){ if(empty($config['login']['failed'])){ $this->error('请设置失败次数'); } if(empty($config['login']['time'])){ $this->error('请设置锁定时间'); } } $mconfig->set('site',$config); $this->success(L('op_success'),U('Setting/site')); }else{ $GLOBALS['content_header']=L('setting_site'); $GLOBALS['breadcrumb']=breadcrumb(array(array('url'=>U('Setting/site'),'title'=>L('setting_site')))); $siteConfig=$mconfig->get('site','data'); $this->assign('siteConfig',$siteConfig); } $this->display(); } public function caijiAction(){ $mconfig=D('Config'); if(IS_POST){ $config=array(); $config['auto']=I('auto',0,'intval'); $config['run']=I('run'); $config['num']=I('num',0,'intval'); $config['interval']=I('interval',0,'intval'); $config['timeout']=I('timeout',0,'intval'); $config['html_interval']=I('html_interval',0,'intval'); $config['download_img']=I('download_img',0,'intval'); $mconfig->set('caiji',$config); if($config['auto']&&$config['run']=='backstage'){ @get_html(U('Admin/Index/backstage',null,false,true),null,array('timeout'=>1)); } $this->success(L('op_success'),U('Setting/caiji')); }else{ $GLOBALS['content_header']=L('setting_caiji'); $GLOBALS['breadcrumb']=breadcrumb(array(array('url'=>U('Setting/caiji'),'title'=>L('setting_caiji')))); $caijiConfig=$mconfig->get('caiji','data'); $this->assign('caijiConfig',$caijiConfig); } $this->display(); } public function proxyAction(){ $mconfig=D('Config'); if(IS_POST){ $config=array(); $config['open']=I('open',0,'intval'); $config['ip_list']=I('ip_list/a'); $config['user_list']=I('user_list/a'); $config['pwd_list']=I('pwd_list/a'); if(is_array($config['ip_list'])&&!empty($config['ip_list'])){ $config['ip_list']=array_map('trim', $config['ip_list']); $config['user_list']=array_map('trim', $config['user_list']); $config['pwd_list']=array_map('trim', $config['pwd_list']); foreach ($config['ip_list'] as $k=>$v){ if(empty($v)){ unset($config['ip_list'][$k]); unset($config['user_list'][$k]); unset($config['pwd_list'][$k]); } } $config['ip_list']=array_values($config['ip_list']); $config['user_list']=array_values($config['user_list']); $config['pwd_list']=array_values($config['pwd_list']); }else{ $config['ip_list']=array(); $config['user_list']=array(); $config['pwd_list']=array(); } $mconfig->set('proxy',$config); $this->success(L('op_success'),U('Setting/Proxy')); }else{ $GLOBALS['content_header']='代理设置'; $GLOBALS['breadcrumb']=breadcrumb(array(array('url'=>U('Setting/Proxy'),'title'=>'代理设置'))); $proxyConfig=$mconfig->get('proxy','data'); $this->assign('proxyConfig',$proxyConfig); } $this->display(); } public function emailAction(){ $is_test=I('is_test',0,'intval'); $mconfig=D('Config'); if(IS_POST){ $config=array(); $config['sender']=I('sender'); $config['email']=I('email'); $config['pwd']=I('pwd'); $config['smtp']=I('smtp'); $config['port']=I('port'); $config['type']=I('type'); if($is_test){ $return=send_mail($config, $config['email'], $config['sender'],L('set_email_test_subject'),L('set_email_test_body')); if($return===true){ $this->success(L('set_email_test_body')); }else{ $this->error($return); } }else{ $mconfig->set('email',$config); $this->success(L('op_success'),U('Setting/email')); } }else{ $GLOBALS['content_header']=L('setting_email'); $GLOBALS['breadcrumb']=breadcrumb(array(array('url'=>U('Setting/email'),'title'=>L('setting_email')))); $emailConfig=$mconfig->get('email','data'); $this->assign('emailConfig',$emailConfig); } $this->display(); } public function cleanAction(){ set_time_limit(1000); $path=realpath(realpath(C('ROOTPATH').'/'.APP_PATH).'/Runtime'); clear_dir($path); $this->success(); } }